(require 'asdf)
(asdf:oos 'asdf:load-op :logo)
(in-package :logo)

(with-logo 
 (fd 150)
 (rt 45)
 (fd 50)
 (lt 90)
 (fd 50))

(defun koch (length depth)
  (let ((third-length (round (/ length 3))))
    (labels ((forward ()
		(if (zerop depth)
		    (fd third-length)
		  (koch third-length (1- depth)))))
      (forward)
      (lt 60)
      (forward)
      (rt 120)
      (forward)
      (lt 60)
      (forward))))

(defun regular-polygon (sides side-length)
  (dotimes (x sides)
    (fd side-length)
    (rt (/ 360 sides))))

(with-logo
 (koch 600 4))

(with-logo
 (regular-polygon 7 100))